IOMMU: Fail if intremap is not available and iommu=required/force.
authorIan Campbell <ian.campbell@citrix.com>
Thu, 26 May 2011 07:18:44 +0000 (08:18 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 26 May 2011 07:18:44 +0000 (08:18 +0100)
Rather than sprinkling panic()s throughout the setup code hoist the
check up into common code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/iommu.c

index c5716bd312ab45d6709addd4a87cbebf07de6ac2..0a9965d4082007c39a4abd81bb7f1bd95e3a5ef5 100644 (file)
@@ -311,6 +311,7 @@ int deassign_device(struct domain *d, u8 bus, u8 devfn)
 int __init iommu_setup(void)
 {
     int rc = -ENODEV;
+    bool_t force_intremap = force_iommu && iommu_intremap;
 
     if ( iommu_dom0_strict )
         iommu_passthrough = 0;
@@ -321,8 +322,10 @@ int __init iommu_setup(void)
         iommu_enabled = (rc == 0);
     }
 
-    if ( force_iommu && !iommu_enabled )
-        panic("IOMMU setup failed, crash Xen for security purpose!\n");
+    if ( (force_iommu && !iommu_enabled) ||
+         (force_intremap && !iommu_intremap) )
+        panic("Couldn't enable %s and iommu=required/force\n",
+              !iommu_enabled ? "IOMMU" : "Interrupt Remapping");
 
     if ( !iommu_enabled )
     {
index cbeec5ce0bd7a00e15eac68f0d994fa0cfe2e1a8..79ab4c20421a6aa170b157978ad254db4d067d8d 100644 (file)
@@ -1971,8 +1971,6 @@ static int init_vtd_hw(void)
                     "ioapic_to_iommu: ioapic 0x%x (id: 0x%x) is NULL! "
                     "Will not try to enable Interrupt Remapping.\n",
                     apic, IO_APIC_ID(apic));
-                if ( force_iommu )
-                    panic("intremap remapping failed to enable with iommu=required/force in grub\n");
                 break;
             }
         }
@@ -1984,11 +1982,10 @@ static int init_vtd_hw(void)
             iommu = drhd->iommu;
             if ( enable_intremap(iommu, 0) != 0 )
             {
+                iommu_intremap = 0;
                 dprintk(XENLOG_WARNING VTDPREFIX,
                         "Interrupt Remapping not enabled\n");
 
-                if ( force_iommu && platform_supports_intremap() )
-                    panic("intremap remapping failed to enable with iommu=required/force in grub\n");
                 break;
             }
         }